package com.testmanager.testmananger.shuiyou.common.web;


import com.testmanager.testmananger.shuiyou.common.domain.SyUserEntity;
import com.testmanager.testmananger.shuiyou.common.service.LoginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
@RequestMapping("/")
public class LoginResource {


    @Autowired
    LoginService loginService;

    @PostMapping("/login/{username}/{password}")
    public ResponseEntity  login(@PathVariable("username")String username,@PathVariable("password")String password){
        return  loginService.login(username,password);

    }

    @PostMapping("/register")
    public ResponseEntity register(@RequestBody SyUserEntity userEntity){

        return loginService.register(userEntity);
    }

}
